<template>
    <van-nav-bar
        :title="title"
        @click-left="onBack"
        @click-right="onClickRight"
    >
    <template slot="left" class="back">
        <img src="../../assets/images/goback.png">
    </template>
    <template slot="right" v-if="showhome">
        <img class="home" src="../../assets/images/tabbar/tabbar_home_nor.jpg">
    </template>
    </van-nav-bar>
</template>

<script>
import { NavBar  } from 'vant';
export default {
    name:'headerNav',
    components:{
         [NavBar.name]: NavBar,
    },
    props:{
        title:String,
        showhome: {
            type: Boolean,
            default: true
        }
    },
    methods: {
        onBack() {
            history.back();
        },
        onClickRight() {
            this.$router.push("/")
        }
    }
}
</script>

<style lang="less">
/deep/ .van-nav-bar__title {
    font-size: 0.4rem;
}
.van-nav-bar{
    position: fixed;
    width: 100%;
    top: 0;
}
.van-nav-bar__left{
    img{
        width: 0.533333rem;
        height: 0.533333rem;
    }
}
.van-nav-bar__right{
    img{
        width: 0.533333rem;
        height: 0.533333rem;
    }
}
</style>
